package com.shensi.api.pay.client;

import com.shensi.api.pay.client.fallback.MemberClientFallBack;
import com.shensi.api.pay.param.vo.AppUserInfoVO;
import com.shensi.api.pay.pojo.dto.CardPasswordDto;
import com.shensi.common.core.constant.CloudConstant;
import com.shensi.api.pay.param.ResultData;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author: budian
 * @since: 2023/11/30
 */
@FeignClient(value = CloudConstant.PAY_SERVER, fallbackFactory = MemberClientFallBack.class)
@Component
public interface MemberClient {


    /*
     * 查询会员信息
     * @param unionId
     * @param enterpriseId
     * @return
     */
    @GetMapping(value = "/selectMemberInfo")
    @ApiOperation(value = "查询会员信息", httpMethod = "GET", notes = "查询会员信息")
    public String selectMemberInfo(@RequestParam("mobilePhone") String mobilePhone, @RequestParam("enterpriseId") Integer enterpriseId);


    /*
     * 更新会员信息
     * @param member
     * @return
     */
    @PostMapping(value = "/updateMemberInfo")
    @ApiOperation(value = "更新会员信息", httpMethod = "POST", notes = "更新会员信息")
    public String updateMemberInfo(@RequestBody AppUserInfoVO appUserInfo);

    /**
     * 查询 电子卡免密支付状态和密码
     * 同一个人在同一油企下 电子卡密码一致，不做区分
     */
    @GetMapping("/select")
    @ApiOperation(value = "查询电子卡免密支付状态和密码", httpMethod = "GET", response = CardPasswordDto.class)
    public ResultData getCustomerElectronicCard(@RequestParam("enterpriseId") Integer enterpriseId,
                                                @RequestParam("mobilePhone") String mobilePhone);

    /**
     * 修改电子卡免密支付状态和密码
     */
    @PostMapping("/update")
    @ApiOperation(value = "修改电子卡免密支付状态和密码", httpMethod = "POST")
    public ResultData updateCustomerElectronicCard(@RequestBody CardPasswordDto cardPasswordDto);

    /**
     * 只查询 电子卡免密支付状态
     */
    @GetMapping("/selectfree")
    @ApiOperation(value = "只查询 电子卡免密支付状态", httpMethod = "GET", response = CardPasswordDto.class)
    public ResultData getCustomerElectronicCardFree(@RequestParam("enterpriseId") Integer enterpriseId,
                                                    @RequestParam("mobilePhone") String mobilePhone);

    /**
     * 密码校验
     */
    @PostMapping("/check")
    @ApiOperation(value = "密码校验", httpMethod = "POST")
    public ResultData checkCustomerElectronicCard(@RequestBody CardPasswordDto cardPasswordDto);

}
